<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'book-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">带 <span class="required">*</span> 的是必填项。</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'bookName'); ?>
		<?php echo $form->textField($model,'bookName',array('size'=>51,'maxlength'=>51)); ?>
		<?php echo $form->error($model,'bookName'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'language'); ?>
		<?php echo $form->dropDownList($model,'language',array(Book::LANG_CN=>Book::LANG_CN,
				Book::LANG_EN=>Book::LANG_EN,	Book::LANG_NAXI=>Book::LANG_NAXI)); ?>
		
		<?php echo $form->error($model,'language'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'author'); ?>
		<?php echo $form->textField($model,'author',array('id'=>'_author1','size'=>21,'maxlength'=>21)); ?>
		<?php  echo CHtml::button('生成四角编码', array('id' => 'beginTest'))?>
		<?php echo $form->error($model,'author'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'fcode'); ?>
		<?php echo $form->textField($model,'fcode',array('id'=>'_fcode1')); ?>
		<?php echo $form->error($model,'fcode'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'translater'); ?>
		<?php echo $form->textField($model,'translater',array('size'=>21,'maxlength'=>21)); ?>
		<?php echo $form->error($model,'translater'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'pub'); ?>
		<?php echo $form->textField($model,'pub',array('size'=>31,'maxlength'=>31)); ?>
		<?php echo $form->error($model,'pub'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'banci'); ?>
		<?php echo $form->textField($model,'banci',array('size'=>9,'maxlength'=>9)); ?>
		<?php echo $form->error($model,'banci'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'price'); ?>
		<?php echo $form->textField($model,'price',array('size'=>8,'maxlength'=>8)); ?>
		<?php echo $form->error($model,'price'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'ISBN'); ?>
		<?php echo $form->textField($model,'ISBN',array('size'=>13,'maxlength'=>13)); ?>
		<?php echo $form->error($model,'ISBN'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'pageCount'); ?>
		<?php echo $form->textField($model,'pageCount'); ?>
		<?php echo $form->error($model,'pageCount'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'typeCode'); ?>
		<?php echo $form->textField($model,'typeCode',array('size'=>20,'maxlength'=>20)); ?>
		<?php echo $form->error($model,'typeCode'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'fcode'); ?>
		<?php echo $form->textField($model,'fcode'); ?>
		<?php echo $form->error($model,'fcode'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'intro'); ?>
		<?php echo $form->textField($model,'intro'); ?>
		<?php echo $form->error($model,'intro'); ?>
	</div>
	
	

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? '新建' : '保存'); ?>
	</div>

	

	
	
<?php $this->endWidget(); ?>


<?php Yii::app()->clientScript->registerCoreScript("jquery")?>

<script type="text/javascript">
jQuery(function($) {
    var newsList = $('#_fcode1');
    function updateNews(){
        newsList.val('计算中...');
        $.ajax({
            url: "<?php echo $this->createUrl('GetFcode')?>",
            dataType: 'json',
            data:{
            	letter:$("#_author1").val()
                },
            cache: false,
            success: function(data) {
                
            	newsList.val(data);
            },
            error:function(){
            	
            	newsList.append('出错啦！');
            }
                
        });
    }

    $("#beginTest").click(function(){
    	updateNews();
        });
   
});

</script>
</div><!-- form -->